﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WLYT.Application.Interfaces;
using WLYT.Common;
using WLYT.Domain.Model;
using WLYT.Repository;

namespace WLYT.Application.Services
{
    public class UserService : IUserService
    {
        public ISqlSugarRepository<User> UserRepository;
        public UserService(ISqlSugarRepository<User> userRepository)
        {
            UserRepository = userRepository;
        }

        public async Task<User> GetModelAsync(string name, string pwd)
        {
            string hashPassword = StringHelper.MD5(pwd);
            User model = await UserRepository.GetFirstAsync(p => p.UserNo == name && p.Password == hashPassword);
            return model;
        }
    }
}
